#include<iostream>
#include<vector>
#include<stdint.h>

#pragma pack(push, 1)
struct ExampleStruct {
    int a;
    uint8_t b;
    uint8_t c;
};
#pragma pack(pop)

std::vector<uint8_t> structToVector(const ExampleStruct& s) {
    uint8_t* ptr = reinterpret_cast<uint8_t*>(const_cast<ExampleStruct*>(&s));
    size_t size = sizeof(ExampleStruct);
    return std::vector<uint8_t>(ptr, ptr + size);
}

int main() {
    ExampleStruct src = { 0xf0,0x11,0x8f};
    std::vector<uint8_t> vec = structToVector(src);

    for (auto tmp : vec) {
        std::cout << std::hex << static_cast<uint32_t>(tmp) << " ";
    }

    return 0;
}